from django.contrib import admin
from .models import Server, Comment, Reply

@admin.register(Server)
class ServerAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'name_cn', 'provider', 'is_official', 'is_internal', 'verified')
    list_filter = ('is_official', 'is_internal', 'verified', 'provider', 'from_site', 'auth_method')
    search_fields = ('name', 'name_cn', 'description', 'description_cn', 'provider')
    ordering = ('name',)


@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
    list_display = ('id', 'user', 'server', 'created_at')
    list_filter = ('server', 'user')
    search_fields = ('content',)
    date_hierarchy = 'created_at'


@admin.register(Reply)
class ReplyAdmin(admin.ModelAdmin):
    list_display = ('id', 'user', 'comment', 'created_at')
    list_filter = ('comment', 'user')
    search_fields = ('content',)
    date_hierarchy = 'created_at'
